package org.aeon.gamechatnest.pojo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.aeon.gamechatnest.validated.Add;
import org.aeon.gamechatnest.validated.Update;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 角色表
 *
 * @TableName role
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "角色表")
@TableName("role")
public class Role implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 角色id
     */
    @Schema(description = "角色id")
    @Null(groups = Add.class, message = "角色id应该为空")
    @NotNull(groups = Update.class, message = "角色id不能为空")
    @TableId
    private Long roleId;
    /**
     * 服务器id
     */
    @Schema(description = "服务器id")
    @NotNull(groups = Add.class, message = "服务器id不能为空")
    @Null(groups = Update.class, message = "服务器id应该为空")
    private Long serverId;
    /**
     * 角色名称
     */
    @Schema(description = "角色名称")
    @NotBlank(groups = {Add.class, Update.class}, message = "角色名称不能为空")
    private String roleName;
    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @Null(groups = {Add.class, Update.class}, message = "创建时间应该为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
